package com.iMusic.businessLogicLayer.testCase;


import com.iMusic.businessLogicLayer.ShippingManager;

import junit.framework.Assert;
import junit.framework.TestCase;

public class TestShippingManagerCase extends TestCase {
	
	public void testgetShippingRate(){
		
		float rate = 0;
		String province1 ="QC";
		String country1 = "Canada";
		rate = ShippingManager.getInstance().getShippingRate(country1, province1);
		Assert.assertEquals("WITHIN_PROVINCE Error!", 3.99, rate,0.001);
		System.out.println("rate"+rate);
		
		String province2 ="BC";
		String country2 = "Canada";
		rate = ShippingManager.getInstance().getShippingRate(country2, province2);
		Assert.assertEquals("WITHIN_COUNTRY Error!", 4.99, rate,0.001);
		System.out.println("rate"+rate);
		
		String province3 ="Beijing";
		String country3 = "China";
		rate = ShippingManager.getInstance().getShippingRate(country3, province3);
		Assert.assertEquals("INTERNATIONAL Error!", 6.99, rate,0.001);
		System.out.println("rate"+rate);
	}

	public void testgetShippingType(){
		
		int type = 0;
		String province1 ="QC";
		String country1 = "Canada";
		type = (int) ShippingManager.getInstance().getShippingType(country1, province1);
		Assert.assertEquals("WITHIN_PROVINCE Error!", 1, type);
		System.out.println("type"+type);
		
		String province2 ="BC";
		String country2 = "Canada";
		type = (int) ShippingManager.getInstance().getShippingType(country2, province2);
		Assert.assertEquals("WITHIN_COUNTRY Error!", 2, type);
		System.out.println("type"+type);
		
		String province3 ="Beijing";
		String country3 = "China";
		type = (int) ShippingManager.getInstance().getShippingType(country3, province3);
		Assert.assertEquals("INTERNATIONAL Error!", 3, type);
		System.out.println("type"+type);
		
	}
}
